package cam.baizhi.test;

import com.baizhi.service.XxxService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ApplicationConText {
    @Test
    public void testXxxService(){
        //如何从Spring工厂中获得配置的bean对象
        //1创建Spring的工厂对象
        //classpath  在 maven项目main/resources都属于classpath路径
       // ApplicationConText是Spring中最重要的工厂类
      ApplicationContext ctx= new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
        //2从Spring工厂中获取配置的bean对象
        XxxService xxxService = (XxxService)ctx.getBean("xxxService");
         xxxService.removeXxxById(2);
    }
}
